<template>
  <div class="pushMgt">
    <div class="title">推送企微号<span>5</span></div>
    <div class="content-big">
      <div class="content-left">
        <ul>
          <li>
            <div class="li-big">
              <div class="userInfo">
                <img src="@/assets/images/profile.jpg"/>
                <div class="name">小城红</div>
                <div class="label">@志新</div>
              </div>
              <div class="right-big">
                <div class="type">暂停中</div>
                <el-dropdown>
                  <i class="el-icon-more" style="cursor: pointer"></i>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>取消</el-dropdown-item>
                    <el-dropdown-item>开启</el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </div>
            </div>
            <div class="bottom-big">
              <div class="bottom-left">
                <div class="onlineType red">离线</div>
                <div class="userNumber">3受众</div>
              </div>
              <div class="bottom-right">
                <div class="">发送进度:<span>0/3</span></div>
              </div>
            </div>

          </li>
          <li>
            <div class="li-big">
              <div class="userInfo">
                <img src="@/assets/images/profile.jpg"/>
                <div class="name">小城红</div>
                <div class="label">@志新</div>
              </div>
              <div class="right-big">
                <div class="type orange">暂停中</div>
              </div>
            </div>
            <div class="bottom-big">
              <div class="bottom-left">
                <div class="onlineType green">离线</div>
                <div class="userNumber">3受众</div>
              </div>
              <div class="bottom-right">
                <div class="">发送进度:<span>0/3</span></div>
              </div>
            </div>

          </li>
        </ul>
      </div>
      <div class="content-right">
        <div class="content-head">
          <div class="tablist">
            <div class="tab-item">已处理对象</div>
            <div class="tab-item">未处理对象</div>
          </div>
          <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="130px">
            <el-form-item prop="userName1">
              <el-input v-model="queryParams.userName1" placeholder="客户" clearable style="width: 240px" @keyup.enter.native="handleQuery" suffix-icon="el-icon-search"/>
            </el-form-item>
            <el-form-item prop="userName3">
              <el-select
                v-model="queryParams.userName3"
                @change="handleQuery"
                placeholder="状态"
              >
                <el-option
                  v-for="item in typeList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-form>
        </div>

        <el-table
          :data="tableDataList"
          :max-height="tableHeight"
          ref="companylabelList"
        >
          <el-table-column
            :label="item.label"
            :align="item.align?item.align:`center`"
            v-for="(item, index) in tableColumns"
            :key="index"
            :prop="item.key"
            :min-width="item.minWidth ? item.minWidth : ``"
            :fixed="item.fixed ? item.fixed : false"
            :show-overflow-tooltip="true"
          >
            <!--用于表格自定义-->
            <template slot-scope="scope">
              <div v-if="item.key=='name'">
                <div class="userInfo">
                  <img src="../../../assets/images/profile.jpg"/>
                  <div class="name">小城红</div>
                  <div class="label" style="color: #00c270">@微信</div>
                </div>
              </div>
              <div class="label-list" v-else-if="item.key=='status'">
                取消
              </div>

              <div v-else style="text-align: center">{{ scope.row[item.key] }}</div>
            </template>
          </el-table-column>
        </el-table>
        <pagination
          v-show="total>0"
          :total="total"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @pagination="getList"
        />
      </div>
    </div>

  </div>
</template>
<script>
import {listUser} from "@/api/system/user";

export default {
  name: "pushMgt",
  data() {
    return {
      tableHeight: 530,
      tableColumns: [
        {key: 'name', label: `客户名`, visible: true, minWidth: 150, fixed: true, align: 'left'},
        {key: 'status', label: `状态`, visible: true, minWidth: 150, fixed: false},
      ],
      typeList: [
        {
          value: 0,
          label: '创建中',
        },
        {
          value: 1,
          label: '等待中',
        },
      ],
      tableDataList: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        id: null,//用户id
        userName1: null,

      },
      total: 8, // 表格的总条数
    }
  },
  created() {
    this.tableDataList = [];
    for (let i = 0; i < 4; i++) {
      let obj = {
        name: '小红',
        label: '18207418337',
        operate: true,
      }
      this.tableDataList.push(obj);
    }
  },
  methods: {
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 查询用户列表 */
    getList() {
      this.loading = true;
      listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
          this.userList = response.rows;
          this.total = response.total;
          this.loading = false;
        }
      );
    },
  },
}
</script>


<style scoped lang="scss">
.pushMgt {
  padding: 15px;
}

.title {
  height: 40px;
  display: flex;
  align-items: center;
  color: rgba(0, 0, 0, .45);
  font-size: 14px;
}

.content-big {
  display: flex;

  .content-left {
    width: 376px;
    padding: 16px 16px 16px 0;
    max-height: calc(100vh - 330px);
    overflow-y: auto;

    ul {
      li {
        border: 1px solid #eee;
        padding: 10px;
        border-radius: 5px;
        margin-bottom: 10px;
      }
    }
  }

  .content-right {
    flex: 1;
    border-left: 1px solid #eee;
    padding-left: 15px;
  }
}

.userInfo {
  border-radius: 4px;
  margin: 8px 0;
  cursor: pointer;
  position: relative;
  padding-left: 50px;
  font-size: 14px;
  list-style: none;
  text-align: left;

  img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    left: 0px;
    top: 0px;
    position: absolute;
  }

  .label {
    margin-top: 2px;
    font-size: 12px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #f90;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.li-big {
  display: flex;
  justify-content: space-between;
  font-size: 14px;

}

.bottom-big {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.bottom-left {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.onlineType {
  height: 26px;
  display: flex;
  align-items: center;
  padding: 0px 10px;
  font-size: 12px;
  border: 1px solid #eee;
  border-radius: 4px;
  margin-right: 10px;
}

.userNumber {
  height: 26px;
  display: flex;
  align-items: center;
  padding: 0px 10px;
  font-size: 12px;
  border: 1px solid #eee;
  border-radius: 4px;
  background: #fafafa;
}

.bottom-right {
  font-size: 14px;
  color: rgba(0, 0, 0, .45);
}

.red {
  color: #f5222d;
  background: #fff1f0;
  border-color: #ffa39e;
}

.green {
  color: #52c41a;
  background: #f6f9f3;
  border-color: #52c41a;
}

.orange {
  color: #f8ac59;
}

.right-big {
  display: flex;
  align-items: center;
  height: 35px;

  .type {
    margin-right: 10px;
  }
}

.tablist {
  display: flex;
  margin-right: 10px;

  .tab-item {
    padding: 0px 15px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border: 1px solid #eee;
  }
}

.content-head {
  display: flex;

}
</style>
